﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CCoTcEndModelingCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.Modeling;
using System.Collections.ObjectModel;
using System.Resources;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Implementation;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands;

public class CCoTcEndModelingCmd : TxButtonCommand
{
  private CApTcEndModelingCmdEnabler m_cmdEnabler;
  private bool m_dialogIsOpen;

  public CCoTcEndModelingCmd()
  {
    this.m_dialogIsOpen = false;
    this.m_cmdEnabler = new CApTcEndModelingCmdEnabler();
  }

  public virtual void Execute(object cmdParams)
  {
    if (!CApSetEndModelingApp.ExeuteSimulationCheck())
      return;
    ITxObject allItem = ((Collection<ITxObject>) TxApplication.ActiveSelection.GetAllItems())[0];
    if (!TxRose.IsStudyPart((allItem as TxObjectBase).Impl))
    {
      if (this.m_dialogIsOpen)
        return;
      ((Control) new CUiTcEndModelingForm(this)).Show();
    }
    else
      CUiTcEndModelingForm.PerformEndModelingOnObject(allItem);
  }

  private ResourceManager GetResourceManager()
  {
    return new ResourceManager("DnProcessSimulateCommands.StringTable", ((object) this).GetType().Assembly);
  }

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_cmdEnabler;

  public virtual string Bitmap => "bmpSaveCompAs.bmp";

  public virtual string LargeBitmap => "bmpSaveCompAs_LARGE.png";

  public virtual string Category
  {
    get => this.GetResourceManager().GetString("END_MODELING_CMD_CATEGORY");
  }

  public virtual string Description
  {
    get => this.GetResourceManager().GetString("END_MODELING_CMD_DESCRIPTION");
  }

  public virtual string Name => this.GetResourceManager().GetString("END_MODELING_CMD_NAME");

  public virtual string Tooltip => this.GetResourceManager().GetString("END_MODELING_CMD_TOOLTIP");

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("EndModeling");

  internal bool IsDialogOpen
  {
    private get => this.m_dialogIsOpen;
    set => this.m_dialogIsOpen = value;
  }
}
